﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Tasks;

namespace XamlingCore.WP.Controls.Buttons
{
    public class XLaunchBrowserHyperlinkButton : HyperlinkButton
    {

        protected override void OnClick()
        {
            if (!String.IsNullOrEmpty(BrowseUrl))
            {
                var task = new WebBrowserTask();
                task.URL = BrowseUrl;
                task.Show();
            }   
        }

        public string BrowseUrl
        {
            get { return (string)GetValue(BrowseUrlProperty); }
            set { SetValue(BrowseUrlProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Url.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty BrowseUrlProperty =
            DependencyProperty.Register("BrowseUrl", typeof(string), typeof(XLaunchBrowserHyperlinkButton), new PropertyMetadata(null));

    }
}
